from config import HOST

class ApiShortLink:
    # 初始化
    def __init__(self, session):
        self.session = session
        self.__url_create_short_link = HOST + "/api/short-link/v1/create"

    # 创建单个短链接接口
    def create_shortlink(self,domain, origin_url, gid, createdType,validDateType,validDate,describe):

        data = {
            "domain": domain,
            "originUrl": origin_url,
            "gid": gid,
            "createdType": createdType,
            "validDateType": validDateType,
            "validDate": validDate,
            "describe": describe,
        }
        return self.session.post(url=self.__url_create_short_link, json=data)